1. Field of the Invention
The present invention relates generally to a language processing system for converting a source program into a computer executable machine language. More specifically, the invention relates to a language processing system which converts a source program described by a program language and including a bank switching instruction for switching the banks by designating bank numbers, into a computer executable machine language, for a computer system which has a data memory space divided into a plurality of banks and executes operations for data memory designated by a bank number and an address in the back designated by the bank number.
2. Description of the Related Art
In microcomputers, there are provided data memories for storing data which is variable upon arithmetic control. The data memory is utilized as a work area for storing input data and results of arithmetic operation of data. In a case where the address of the data memory to be designated by an operand of the program instruction is n bits in length, the data memory space to be accessed at one time becomes 2.sup.n nibbles. In order to expand the space of the data memory to be accessed at one time, a principle of the bank has been proposed.
For instance, when the data memory is to be accessed, by adding m bits of the bank to n bits of the address, it becomes possible to access the address space of n+m bits.
Therefore, the data memory is divided into 2.sup.m banks. Each bank has the size of 2.sup.n nibbles. Therefore, the size of the data memory to be installed becomes 2.sup.n .times.2.sup.m.
In such a microcomputer, the data memory space expanded by the bank can be operated. However, the data memory space to be directly accessed by the instruction is limited in one bank (the data memory space of 2.sup.n nibbles in the foregoing example). Accordingly, in the machine language instruction to operate the content on the data memory, the content of the address of the specific bank is operated by designating with the bank number and the address.
On the other hand, a bank register is provided in the system of the microcomputer for setting the current bank number so as to avoid inconsistency between the bank number at the system side and the bank number designated by the instruction by setting the bank number to be operated by the machine language instruction in the bank register in advance of execution of the machine language instruction for operating the content on the data memory. It is typical to provide a dedicated bank switching instruction (BANKn) for setting the bank number to the bank register.
On the other hand, in the source program, there is contained a branch instruction having a function for branching to an arbitrary other target address (hereinafter referred to as a "label") from the current instruction. In order to identify a branching destination, a label is set.
The instruction described by the source program contains an instruction for operating the content of the address on the data memory. When contents of addresses on a plurality of banks (when numbers of the banks are different) are operated in one program, the instruction in the source program becomes as illustrated in FIG. 9.
With the instruction BANKn1001 for setting the bank number, the bank number of the data memory to be operated by the instruction 1002 is adapted to operate the content of the subsequent address of the data memory. When the instruction 1004 for operating the content on the data memory follows, it is possible that the addresses to be operated by the instructions 1002 and 1004 are not in the same bank. Therefore, it becomes necessary to insert the instruction BANKm1003 for setting the bank number of the data memory to be operated by the instruction 1004.
However, if the bank numbers to be operated by the instruction 1002 and the instruction 1004 are different (i.e., n.noteq.m), the instruction BANKm1003 is always required, whereas if the bank numbers are the same, the instruction BANKm1003 becomes unnecessary.
In the conventional language processing system to convert the source program into the machine language, the system simply converts the source program into the machine language on a line by line basis. Therefore, even when an unnecessary back switching instruction is contained in the source program, it is inherently converted into machine language to make the execution program unnecessarily long.